from django.db import models

# Create your models here.



#注册
class Usermodel(models.Model):
    name=models.CharField('账号',max_length=200)
    di=models.CharField('我的ID',max_length=200)
    wo=models.CharField('名称',max_length=200)
    mobile=models.CharField('手机号',max_length=11)
    password=models.CharField('密码',max_length=200)
    xin=models.CharField('性别',max_length=200)
    shen=models.CharField('生日',max_length=20)
    xuan=models.CharField('宣言',max_length=200)
    class Meta:
        verbose_name_plural='注册'
        db_table='usermodel'
    def __str__(self):
        return self.name


#分类
class   BookCateModel(models.Model):
    name = models.CharField('类型', max_length=200)
    ss=models.ForeignKey(Usermodel,on_delete=models.CASCADE,verbose_name='账号外键')
    class Meta:
        verbose_name_plural = '分类'
        db_table = 'bookCateModel'

    def __str__(self):
        return self.name



# 类型
class BookModel(models.Model):
    name = models.CharField('书名', max_length=200)
    zhu= models.CharField('作者', max_length=200)
    img= models.CharField('图片', max_length=200)
    shou=models.CharField(max_length=20,choices=((0,'取消收藏'),(1,'收藏')),verbose_name='收藏')
    tt = models.ForeignKey(BookCateModel,on_delete=models.CASCADE, verbose_name='分类外键')
    class Meta:
        verbose_name_plural = '类型'
        db_table = 'bookModel'

    def __str__(self):
        return self.name



#头像
class  Collection(models.Model):
    name=models.CharField('详情', max_length=200)
    img = models.CharField('图片', max_length=200)
    class Meta:
        verbose_name_plural = '头像'
        db_table = 'Collection'

    def __str__(self):
        return self.name





